package com.tanhua.job;

import com.tanhua.service.LogService;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class AnalysisJob {
    @Autowired
    private LogService logService;

    /**
     * 每半个小时统计一次tb_log数据
     */
    @Scheduled(cron = "0 0/30 * * * ?")
    public void analysis() {
        System.out.println("==开始统计，当前时间是：" + new DateTime().toString("yyyy-MM-dd HH:mm:ss") + "==");
        logService.analysis();
        System.out.println("===统计完成===");
    }
}
